package com.hyh.baowenlioaworking.commom;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hyh.baowenlioaworking.model.Position;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.servlet.http.HttpSession;
import java.io.Serializable;

/**
 * @BelongsPackage: com.hyh.baowenlioaworking.commom
 * @ClassName R
 * @Author: hyhWTX
 * @CreateTime: 2023-07-21  16:26
 * @Description: TODO (一句话描述以下该类的功能)
 * @Version: 1.0
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R <T>  {
    private String code;
    private String message;
    private Object data;
    //成功无数据
    public static R success() {
        return new R(Constants.CODE_200, "", null);
    }

    //成功有数据
    public static R success(String code, Object data) {
        return new R(Constants.CODE_200, "", data);
    }

    //错误
    public static R error(String code, String msg) {
        return new R(code, msg, null);
    }

    public static R error() {
        return new R(Constants.CODE_500, "系统错误", null);
    }


}
